package dao.mapper.auth;

import model.auth.AuthoritiesResources;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.mybatis.spring.annotation.Mapper;

@Mapper("auth.AuthoritiesResourcesCrudMapper")
public interface AuthoritiesResourcesCrudMapper {

	@Select("select seq_a_authoritiesresources.nextval from dual")
	long selectKey();
	
	@Insert("insert into a_authorities_resources (id, authorityid, resourceid) values (#{m.id}, #{m.authorityid}, #{m.resourceid})")
	int insert(@Param("m") AuthoritiesResources model);
	
	@Select("select * from a_authoritiesresources where id=#{id} ")
	AuthoritiesResources getById(@Param("id") Long id);

	@Select("select * from a_authoritiesresources where id=#{id} and enabled=#{enabled}")
	AuthoritiesResources getValidById(@Param("id") Long id, @Param("enabled") Integer enabled);
	
	@Delete("delete from a_authoritiesresources where id=#{id}")
	int deleteById(@Param("id") Long id);
}
